package com.gd.iot.energy.pojo.common.dto;


import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * @author kris
 */
@Setter
@Getter
@ToString
public class PasswordLoginFormDTO implements Serializable {

    /**
     * @fieldName: username
     * @fieldType: String
     * @Description:  用户名
     */
    @ApiModelProperty(value = "用户名", hidden = false)
    private String username;

    /**
     * @fieldName: password
     * @fieldType: String
     * @Description:  用户名
     */
    @ApiModelProperty(value = "密码", hidden = false)
    private String password;

    /**
     * @fieldName: code
     * @fieldType: String
     * @Description:  验证码
     */
    @ApiModelProperty(value = "验证码", hidden = false)
    private String code;

    /**
     * @fieldName: sessionId
     * @fieldType: String
     * @Description:  存放验证码的sessionId
     */
    @ApiModelProperty(value = "存放验证码的sessionId", hidden = false)
    protected String sessionId;

    /**
     * 验证用户名、密码、验证码是否为空
     * @return 是否验证通过
     */
    public boolean validateNotEmpty(){
        return !StrUtil.isEmpty(username)
                && !StrUtil.isEmpty(password)
                && !StrUtil.isEmpty(code)
                && !StrUtil.isEmpty(sessionId);
    }
}
